package com.fleapx.spring.hook.springhooktest.aware;

import com.fleapx.spring.hook.springhooktest.applicationlistener.ApplicationEventDef;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ApplicationContextAwareTest implements ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("---------ApplicationContext回调--------------");
        System.out.println(applicationContext.getBean("factoryBeanTest"));
        System.out.println("-----------------------------------------------");
        System.out.println(applicationContext.getBean("&factoryBeanTest"));
        System.out.println("---------ApplicationContext回调结束--------------");
        applicationContext.publishEvent(new ApplicationEventDef("你好！"));
    }
}
